Analysis of Food Insecurity

Even though the USA is a first world country, 40 million Americans, including 12 million children, are “food insecure.” The U.S. Department of Agriculture (USDA), defines food insecurity as an “economic and social condition of limited or uncertain access to adequate food.” Exactly what this definition means is matter of metrics and their interpretation. Because food insecurity may be affecting different demographics differently, we should measure and understand those differences. Food insecurity can lead to negative consequences for individuals’ health and economic well being. What those consequences are and their severity can also be measured. If food insecurity is weighing down a significant part of our society, and if we choose to do something about it, we should try to understand the factors that may be related to or may be predictors of food insecurity. If we design and implement policies and programs to address food insecurity, we should be able to measure their impact on the problem.

The USDA collects and maintains data related to issues outlined above in a “Food Environment Atlas.” The fundamental measure of food insecurity comes from an annual household survey. The survey has questions to assess different experiences and behaviors that indicate food insecurity, such as being unable to afford balanced meals, cutting the size of meals because of too little money for food, or being hungry because of too little money for food. The food security status of a household is designated as secure, insecure, or very insecure based on the number of food-insecure conditions reported. This data is aggregated to the state level in the Atlas.

A hierarchy of factors are believed to be causes of food insecurity. These factors are availability (of food sources in a geographic region), access (to the food sources by the population), and utilization (of food sources by the population). The Atlas maintains three broad categories of data:

Food Choices—Indicators of the community's access to and acquisition of healthy, affordable food, such as: access and proximity to a grocery store; number of food stores and restaurants; expenditures on fast foods; food and nutrition assistance program participation; food prices; food taxes; and availability of local foods.

Health and Well-Being—Indicators of the community's success in maintaining healthy diets, such as: food insecurity; diabetes and obesity rates; and physical activity levels.

Community Characteristics—Indicators of community characteristics that might influence the food environment, such as: demographic composition; income and poverty; population loss; metro-nonmetro status; natural amenities; and recreation and fitness centers.

These add up to over 275 indicators of the food environment collected at the county or the state level. This data can be processed and analyzed to create maps showing variation of individual indicators across the country, create charts showing variation in a single indicator over time, and correlation between individual factors. Additional data related to pilot or new programs can potentially be combined with the Atlas data to judge the effectiveness of those programs.

The purpose of this project is to examine the factors affecting food insecurity on a county and state wide level throughout the US. We will get our data from the Food Environment Atlas (located at https://www.ers.usda.gov/data-products/food-environment-atlas.aspx) and use data processing techniques to find the relationships between several variables, including food access, food availability, assistance, prices, local foods, demographics, insecurity, and health.

In [68]:
import numpy as np
import datetime as dt
import pandas as pd
from math import sqrt
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import datasets, linear_model
import statistics as stat
import xlrd

import json
import vincent

from IPython.display import Image

# vincent.core.initialize_notebook()

# world_topo = r'world-countries.topo.json'
# state_topo = r'us_states.topo.json'
# lake_topo = r'lakes_50m.topo.json'
# county_geo = r'us_counties.geo.json'
# county_topo = r'us_counties.topo.json'
# or_topo = r'or_counties.topo.json'
In [69]:
xl = pd.ExcelFile("DataDownload.xls")
In [70]:
xl.sheet_names
Out[70]:
['Read_Me',
 'Variable List',
 'Supplemental Data - County',
 'Supplemental Data - State',
 'ACCESS',
 'STORES',
 'RESTAURANTS',
 'ASSISTANCE',
 'INSECURITY',
 'PRICES_TAXES',
 'LOCAL',
 'HEALTH',
 'SOCIOECONOMIC']
In [71]:
df_data = xl.parse("Supplemental Data - County")

df_acc = xl.parse("ACCESS")
df_acc = df_acc.drop(['State', 'County'], axis = 1)
df_sto = xl.parse("STORES")
df_sto = df_sto.drop(['State', 'County'], axis = 1)
df_res = xl.parse("RESTAURANTS")
df_res = df_res.drop(['State', 'County'], axis = 1)
df_ass = xl.parse("ASSISTANCE")
df_ass = df_ass.drop(['State', 'County'], axis = 1)
df_ins = xl.parse("INSECURITY")
df_ins = df_ins.drop(['State', 'County'], axis = 1)
df_pri = xl.parse("PRICES_TAXES")
df_pri = df_pri.drop(['State', 'County'], axis = 1)
df_loc = xl.parse("LOCAL")
df_loc = df_loc.drop(['State', 'County'], axis = 1)
df_hea = xl.parse("HEALTH")
df_hea = df_hea.drop(['State', 'County'], axis = 1)
df_soc = xl.parse("SOCIOECONOMIC")
df_soc = df_soc.drop(['State', 'County'], axis = 1)
In [72]:
print("""
      To be able to map this crime data, we needed to get the coordinates correspoding to the addresses.
      We decided to use the GoogleMaps API in order to do this, but realized that when you query the API it
      only takes in addresses in certain formats.
      Thus, the building names that were included in some of the addresses needed to be taken
      out and stored in a different column so that we could have a column with only the addresses.
 """)
      To be able to map this crime data, we needed to get the coordinates correspoding to the addresses.
      We decided to use the GoogleMaps API in order to do this, but realized that when you query the API it
      only takes in addresses in certain formats.
      Thus, the building names that were included in some of the addresses needed to be taken
      out and stored in a different column so that we could have a column with only the addresses.
 
In [73]:
df = df_data.copy()
df = df.rename(columns = {'FIPS ': 'FIPS', 'State': 'State_temp', 'County': 'County_temp'})

df = df.merge(df_acc, how = 'inner', on = 'FIPS')
df = df.merge(df_sto, how = 'inner', on = 'FIPS')
df = df.merge(df_res, how = 'inner', on = 'FIPS')
df = df.merge(df_ass, how = 'inner', on = 'FIPS')
df = df.merge(df_ins, how = 'inner', on = 'FIPS')
df = df.merge(df_pri, how = 'inner', on = 'FIPS')
df = df.merge(df_loc, how = 'inner', on = 'FIPS')
df = df.merge(df_hea, how = 'inner', on = 'FIPS')
df = df.merge(df_soc, how = 'inner', on = 'FIPS')

df = df.rename(columns = {'State_temp': 'State', 'County_temp': 'County'})

temp = list(df['FIPS'])
for i in range(len(temp)):
    temp[i] = str(temp[i])
    if len(temp[i]) < 5:
        temp[i] = '0' + temp[i]
df['FIPS'] = temp

temp = list(df['2010 Census Population'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['2010 Census Population'] = temp

temp = list(df['Population Estimate, 2011'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2011'] = temp

temp = list(df['Population Estimate, 2012'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2012'] = temp

temp = list(df['Population Estimate, 2013'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2013'] = temp

temp = list(df['Population Estimate, 2014'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2014'] = temp

temp = list(df['Population Estimate, 2015'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2015'] = temp

temp = list(df['Population Estimate, 2016'])
for i in range(len(temp)):
    temp[i] = int(temp[i].replace(',',''))
df['Population Estimate, 2016'] = temp
In [74]:
print("""
To be able to map this food data, we needed to get the coordinates correspoding to each of the counties represented.
We decided to use the Vincent API in order to do this, but realized that when you query the API it only takes in addresses in certain formats. Thus, the building names that were included in some of the addresses needed to be taken out and stored in a different column so that we could have a column with only the addresses.

We created a BUILDING column to store the building names separately. We used the fact that addresses with building names were stored in the fromat building_name at address to our advantage. We looked at each address and if it had the string " at " inside it using pandas .find() function, we put everything before the " at " into the building column and everything after remained in the LOCATION column. Addresses without a buidling were left untouched and the value in the building column was set to NaN. Remember, this is all part of tidying data.


""")
To be able to map this food data, we needed to get the coordinates correspoding to each of the counties represented.
We decided to use the Vincent API in order to do this, but realized that when you query the API it only takes in addresses in certain formats. Thus, the building names that were included in some of the addresses needed to be taken out and stored in a different column so that we could have a column with only the addresses.

We created a BUILDING column to store the building names separately. We used the fact that addresses with building names were stored in the fromat building_name at address to our advantage. We looked at each address and if it had the string " at " inside it using pandas .find() function, we put everything before the " at " into the building column and everything after remained in the LOCATION column. Addresses without a buidling were left untouched and the value in the building column was set to NaN. Remember, this is all part of tidying data.



In [75]:
df
Out[75]:
FIPS State County 2010 Census Population Population Estimate, 2011 Population Estimate, 2012 Population Estimate, 2013 Population Estimate, 2014 Population Estimate, 2015 Population Estimate, 2016 ... PCT_NHPI10 PCT_65OLDER10 PCT_18YOUNGER10 MEDHHINC15 POVRATE15 PERPOV10 CHILDPOVRATE15 PERCHLDPOV10 METRO13 POPLOSS10
0 01001 Alabama Autauga 54571 55255 55027 54792 54977 55035 55416 ... 0.040314 11.995382 26.777959 56580.0 12.7 0 18.8 0 1 0.0
1 01003 Alabama Baldwin 182265 186653 190403 195147 199745 203690 208563 ... 0.043343 16.771185 22.987408 52387.0 12.9 0 19.6 0 1 0.0
2 01005 Alabama Barbour 27457 27326 27132 26938 26763 26270 25965 ... 0.087409 14.236807 21.906982 31433.0 32.0 1 45.2 1 0 0.0
3 01007 Alabama Bibb 22915 22736 22645 22501 22511 22561 22643 ... 0.030548 12.681650 22.696923 40767.0 22.2 0 29.3 1 1 0.0
4 01009 Alabama Blount 57322 57707 57772 57746 57621 57676 57704 ... 0.031402 14.722096 24.608353 50487.0 14.7 0 22.2 0 1 0.0
5 01011 Alabama Bullock 10914 10722 10654 10576 10712 10455 10362 ... 0.036650 13.459776 22.264981 28251.0 39.6 1 51.2 1 0 0.0
6 01013 Alabama Butler 20947 20848 20665 20330 20283 20126 19998 ... 0.033418 16.656323 24.137108 33868.0 25.8 1 36.0 1 0 1.0
7 01015 Alabama Calhoun 118572 117736 117208 116475 115837 115285 114611 ... 0.079277 14.328847 22.877239 42091.0 20.0 0 30.7 0 1 0.0
8 01017 Alabama Chambers 34215 34006 34084 34123 33996 34043 33843 ... 0.020459 16.676896 22.513517 35560.0 22.4 0 34.4 1 0 1.0
9 01019 Alabama Cherokee 25989 26073 26017 26074 25944 25726 25725 ... 0.003848 17.896033 21.416753 39144.0 19.4 0 30.2 0 0 0.0
10 01021 Alabama Chilton 43643 43758 43693 43769 43874 43809 43941 ... 0.025205 13.566895 25.112847 42767.0 20.2 0 28.1 0 1 0.0
11 01023 Alabama Choctaw 13859 13610 13549 13384 13310 13201 12993 ... 0.000000 18.175915 22.663973 35089.0 24.4 1 33.5 1 0 1.0
12 01025 Alabama Clarke 25833 25549 25148 25105 24862 24726 24392 ... 0.015484 16.157628 24.731932 37317.0 22.2 1 30.9 1 0 0.0
13 01027 Alabama Clay 13932 13676 13461 13464 13503 13495 13492 ... 0.000000 17.578237 22.566753 38908.0 18.4 0 27.3 0 0 0.0
14 01029 Alabama Cleburne 14972 14976 14928 15031 15076 14996 14924 ... 0.006679 15.769436 23.717606 42136.0 18.9 0 27.7 0 0 0.0
15 01031 Alabama Coffee 49948 50484 51180 50729 50757 51063 51226 ... 0.102106 14.435012 24.193161 46858.0 16.2 0 23.7 0 0 0.0
16 01033 Alabama Colbert 54428 54460 54493 54456 54427 54295 54216 ... 0.025722 17.386272 22.109943 41171.0 18.1 0 26.9 0 1 0.0
17 01035 Alabama Conecuh 13228 13193 13007 12866 12621 12597 12395 ... 0.000000 17.856063 22.996674 29981.0 28.3 1 41.0 1 0 0.0
18 01037 Alabama Coosa 11539 11369 11201 11058 10794 10687 10581 ... 0.000000 17.072537 20.539042 36078.0 20.3 0 32.2 0 0 0.0
19 01039 Alabama Covington 37765 38066 37842 37890 37795 37661 37458 ... 0.002648 18.374156 22.568516 36355.0 22.3 0 34.1 1 0 0.0
20 01041 Alabama Crenshaw 13906 13903 13920 13874 13898 13876 13913 ... 0.007191 15.892421 23.788293 36759.0 19.9 0 29.6 1 0 0.0
21 01043 Alabama Cullman 80406 80457 80351 80731 81167 81858 82471 ... 0.022386 15.931647 23.183593 39290.0 19.4 0 24.7 0 0 0.0
22 01045 Alabama Dale 50251 50119 50296 49753 49389 49370 49226 ... 0.083580 13.450479 24.829357 45294.0 18.5 0 29.0 0 0 0.0
23 01047 Alabama Dallas 43820 43207 42748 41950 41532 40893 40008 ... 0.013692 14.068918 26.460520 29682.0 34.6 1 50.1 1 0 1.0
24 01049 Alabama DeKalb 71109 71389 70961 70882 70947 70996 70900 ... 0.049220 13.887131 25.827954 37305.0 20.6 0 28.9 0 0 0.0
25 01051 Alabama Elmore 79303 80030 80291 80661 80794 81238 81799 ... 0.063049 11.898667 23.589272 53548.0 14.0 0 19.9 0 1 0.0
26 01053 Alabama Escambia 38319 38227 38063 37877 37878 37827 37728 ... 0.031316 15.167410 22.649338 36840.0 24.4 1 32.0 1 0 0.0
27 01055 Alabama Etowah 104430 104236 104215 103790 103371 102873 102564 ... 0.028727 15.807718 22.968496 42145.0 19.0 0 30.7 0 1 0.0
28 01057 Alabama Fayette 17241 17063 16966 16858 16821 16723 16546 ... 0.000000 17.887594 22.255090 37085.0 20.4 0 29.4 0 0 0.0
29 01059 Alabama Franklin 31704 31734 31652 31505 31540 31542 31628 ... 0.006308 15.218900 24.813904 38535.0 21.1 0 32.4 0 0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3110 55129 Wisconsin Washburn 15911 15792 15845 15675 15701 15556 15648 ... 0.012570 21.243165 20.312991 45043.0 13.5 0 22.7 0 0 0.0
3111 55131 Wisconsin Washington 131887 132292 132727 132841 133433 133815 134296 ... 0.016681 13.498677 24.549046 70778.0 5.3 0 6.4 0 1 0.0
3112 55133 Wisconsin Waukesha 389891 390811 392709 394059 395383 396311 398424 ... 0.030008 14.282966 24.060571 78689.0 4.7 0 5.1 0 1 0.0
3113 55135 Wisconsin Waupaca 52410 52322 52040 52262 52108 51925 51533 ... 0.009540 18.053807 22.648350 54849.0 10.7 0 14.4 0 0 0.0
3114 55137 Wisconsin Waushara 24496 24579 24479 24324 24186 24041 24162 ... 0.040823 19.933867 19.733834 49912.0 11.8 0 20.2 0 0 0.0
3115 55139 Wisconsin Winnebago 166994 167646 168764 169518 169701 169565 169886 ... 0.031139 13.375331 21.636706 52725.0 11.3 0 13.3 0 1 0.0
3116 55141 Wisconsin Wood 74749 74588 74306 73892 73514 73288 73107 ... 0.010702 17.073138 22.748130 51025.0 11.3 0 16.1 0 0 0.0
3117 56001 Wyoming Albany 36299 36895 37364 37636 37846 38079 38256 ... 0.046833 8.722003 16.631312 44455.0 20.1 0 15.9 0 0 0.0
3118 56003 Wyoming Big Horn 11668 11742 11781 11979 11898 11991 12005 ... 0.017141 18.066507 25.822763 50056.0 12.1 0 13.9 0 0 0.0
3119 56005 Wyoming Campbell 46133 46594 47872 48116 48241 49333 48803 ... 0.039018 5.670561 28.140377 83042.0 7.5 0 8.9 0 0 0.0
3120 56007 Wyoming Carbon 15885 15824 15681 15799 15829 15554 15618 ... 0.081838 12.867485 23.613472 60209.0 11.4 0 13.7 0 0 0.0
3121 56009 Wyoming Converse 13833 13730 14035 14358 14210 14321 14191 ... 0.007229 12.838864 25.388564 70307.0 8.5 0 11.3 0 0 0.0
3122 56011 Wyoming Crook 7083 7139 7152 7154 7237 7414 7464 ... 0.000000 16.236058 23.845828 64851.0 7.7 0 10.7 0 0 0.0
3123 56013 Wyoming Fremont 40123 40595 41130 41010 40680 40355 40242 ... 0.017446 14.468011 25.451736 52408.0 12.9 0 18.2 0 0 0.0
3124 56015 Wyoming Goshen 13249 13592 13656 13547 13546 13592 13390 ... 0.075477 18.869349 20.386444 48146.0 15.1 0 19.3 0 0 0.0
3125 56017 Wyoming Hot Springs 4812 4819 4843 4840 4797 4745 4679 ... 0.062344 22.610141 20.033250 46021.0 11.9 0 16.3 0 0 0.0
3126 56019 Wyoming Johnson 8569 8632 8608 8619 8562 8587 8486 ... 0.000000 18.531917 22.126269 56845.0 8.2 0 10.6 0 0 0.0
3127 56021 Wyoming Laramie 91738 92637 94785 95929 96264 97183 98136 ... 0.129717 12.541150 24.418453 59147.0 10.6 0 13.6 0 1 0.0
3128 56023 Wyoming Lincoln 18106 18018 17940 18327 18580 18757 19110 ... 0.022092 12.377113 28.189550 62364.0 8.8 0 10.6 0 0 0.0
3129 56025 Wyoming Natrona 75450 76410 78602 81092 81432 82191 81039 ... 0.046388 12.447979 23.883366 56703.0 11.0 0 14.2 0 1 0.0
3130 56027 Wyoming Niobrara 2484 2487 2474 2546 2491 2497 2480 ... 0.000000 20.652174 18.921095 46693.0 13.3 0 19.0 0 0 0.0
3131 56029 Wyoming Park 28205 28476 28839 29096 29069 29056 29353 ... 0.088637 17.521716 20.957277 55527.0 9.6 0 13.8 0 0 0.0
3132 56031 Wyoming Platte 8667 8703 8736 8703 8775 8805 8680 ... 0.057690 20.733818 20.364601 51863.0 11.7 0 17.4 0 0 0.0
3133 56033 Wyoming Sheridan 29116 29285 29580 29777 29994 30069 30200 ... 0.048084 15.620278 22.272977 57122.0 9.5 0 13.2 0 0 0.0
3134 56035 Wyoming Sublette 10247 10145 10414 10082 10019 9877 9769 ... 0.009759 10.139553 23.694740 77581.0 6.1 0 7.1 0 0 0.0
3135 56037 Wyoming Sweetwater 43806 44028 45086 45144 44970 44693 44165 ... 0.093594 8.316212 27.094462 71867.0 8.5 0 10.2 0 0 0.0
3136 56039 Wyoming Teton 21294 21474 21688 22319 22846 23073 23191 ... 0.061050 9.852541 19.141542 83290.0 6.6 0 7.6 0 0 0.0
3137 56041 Wyoming Uinta 21118 20918 20997 21006 20871 20819 20773 ... 0.161000 8.873946 30.168577 62968.0 9.8 0 11.9 0 0 0.0
3138 56043 Wyoming Washakie 8533 8470 8437 8442 8306 8334 8235 ... 0.011719 17.672565 25.454119 56088.0 11.2 0 15.7 0 0 0.0
3139 56045 Wyoming Weston 7208 7112 7065 7163 7179 7230 7236 ... 0.027747 15.940622 21.822974 60986.0 9.8 0 13.1 0 0 0.0

3140 rows × 287 columns

In [76]:
list(df.columns)
Out[76]:
['FIPS',
 'State',
 'County',
 '2010 Census Population',
 'Population Estimate, 2011',
 'Population Estimate, 2012',
 'Population Estimate, 2013',
 'Population Estimate, 2014',
 'Population Estimate, 2015',
 'Population Estimate, 2016',
 'LACCESS_POP10',
 'LACCESS_POP15',
 'PCH_LACCESS_POP_10_15',
 'PCT_LACCESS_POP10',
 'PCT_LACCESS_POP15',
 'LACCESS_LOWI10',
 'LACCESS_LOWI15',
 'PCH_LACCESS_LOWI_10_15',
 'PCT_LACCESS_LOWI10',
 'PCT_LACCESS_LOWI15',
 'LACCESS_HHNV10',
 'LACCESS_HHNV15',
 'PCH_LACCESS_HHNV_10_15',
 'PCT_LACCESS_HHNV10',
 'PCT_LACCESS_HHNV15',
 'LACCESS_SNAP15',
 'PCT_LACCESS_SNAP15',
 'LACCESS_CHILD10',
 'LACCESS_CHILD15',
 'LACCESS_CHILD_10_15',
 'PCT_LACCESS_CHILD10',
 'PCT_LACCESS_CHILD15',
 'LACCESS_SENIORS10',
 'LACCESS_SENIORS15',
 'PCH_LACCESS_SENIORS_10_15',
 'PCT_LACCESS_SENIORS10',
 'PCT_LACCESS_SENIORS15',
 'LACCESS_WHITE15',
 'PCT_LACCESS_WHITE15',
 'LACCESS_BLACK15',
 'PCT_LACCESS_BLACK15',
 'LACCESS_HISP15',
 'PCT_LACCESS_HISP15',
 'LACCESS_NHASIAN15',
 'PCT_LACCESS_NHASIAN15',
 'LACCESS_NHNA15',
 'PCT_LACCESS_NHNA15',
 'LACCESS_NHPI15',
 'PCT_LACCESS_NHPI15',
 'LACCESS_MULTIR15',
 'PCT_LACCESS_MULTIR15',
 'GROC09',
 'GROC14',
 'PCH_GROC_09_14',
 'GROCPTH09',
 'GROCPTH14',
 'PCH_GROCPTH_09_14',
 'SUPERC09',
 'SUPERC14',
 'PCH_SUPERC_09_14',
 'SUPERCPTH09',
 'SUPERCPTH14',
 'PCH_SUPERCPTH_09_14',
 'CONVS09',
 'CONVS14',
 'PCH_CONVS_09_14',
 'CONVSPTH09',
 'CONVSPTH14',
 'PCH_CONVSPTH_09_14',
 'SPECS09',
 'SPECS14',
 'PCH_SPECS_09_14',
 'SPECSPTH09',
 'SPECSPTH14',
 'PCH_SPECSPTH_09_14',
 'SNAPS12',
 'SNAPS16',
 'PCH_SNAPS_12_16',
 'SNAPSPTH12',
 'SNAPSPTH16',
 'PCH_SNAPSPTH_12_16',
 'WICS08',
 'WICS12',
 'PCH_WICS_08_12',
 'WICSPTH08',
 'WICSPTH12',
 'PCH_WICSPTH_08_12',
 'FFR09',
 'FFR14',
 'PCH_FFR_09_14',
 'FFRPTH09',
 'FFRPTH14',
 'PCH_FFRPTH_09_14',
 'FSR09',
 'FSR14',
 'PCH_FSR_09_14',
 'FSRPTH09',
 'FSRPTH14',
 'PCH_FSRPTH_09_14',
 'PC_FFRSALES07',
 'PC_FFRSALES12',
 'PC_FSRSALES07',
 'PC_FSRSALES12',
 'REDEMP_SNAPS12',
 'REDEMP_SNAPS16',
 'PCH_REDEMP_SNAPS_12_16',
 'PCT_SNAP12',
 'PCT_SNAP16',
 'PCH_SNAP_12_16',
 'PC_SNAPBEN10',
 'PC_SNAPBEN15',
 'PCH_PC_SNAPBEN_10_15',
 'SNAP_PART_RATE08',
 'SNAP_PART_RATE13',
 'SNAP_OAPP09',
 'SNAP_OAPP16',
 'SNAP_CAP09',
 'SNAP_CAP16',
 'SNAP_BBCE09',
 'SNAP_BBCE16',
 'SNAP_REPORTSIMPLE09',
 'SNAP_REPORTSIMPLE16',
 'PCT_NSLP09',
 'PCT_NSLP15',
 'PCH_NSLP_09_15',
 'PCT_FREE_LUNCH09',
 'PCT_FREE_LUNCH14',
 'PCT_REDUCED_LUNCH09',
 'PCT_REDUCED_LUNCH14',
 'PCT_SBP09',
 'PCT_SBP15',
 'PCH_SBP_09_15',
 'PCT_SFSP09',
 'PCT_SFSP15',
 'PCH_SFSP_09_15',
 'PC_WIC_REDEMP08',
 'PC_WIC_REDEMP12',
 'PCH_PC_WIC_REDEMP_08_12',
 'REDEMP_WICS08',
 'REDEMP_WICS12',
 'PCH_REDEMP_WICS_08_12',
 'PCT_WIC09',
 'PCT_WIC15',
 'PCH_WIC_09_15',
 'PCT_CACFP09',
 'PCT_CACFP15',
 'PCH_CACFP_09_15',
 'FDPIR12',
 'FOODINSEC_10_12',
 'FOODINSEC_13_15',
 'CH_FOODINSEC_12_15',
 'VLFOODSEC_10_12',
 'VLFOODSEC_13_15',
 'CH_VLFOODSEC_12_15',
 'FOODINSEC_CHILD_01_07',
 'FOODINSEC_CHILD_03_11',
 'MILK_PRICE10',
 'SODA_PRICE10',
 'MILK_SODA_PRICE10',
 'SODATAX_STORES14',
 'SODATAX_VENDM14',
 'CHIPSTAX_STORES14',
 'CHIPSTAX_VENDM14',
 'FOOD_TAX14',
 'DIRSALES_FARMS07',
 'DIRSALES_FARMS12',
 'PCH_DIRSALES_FARMS_07_12',
 'PCT_LOCLFARM07',
 'PCT_LOCLFARM12',
 'PCT_LOCLSALE07',
 'PCT_LOCLSALE12',
 'DIRSALES07',
 'DIRSALES12',
 'PCH_DIRSALES_07_12',
 'PC_DIRSALES07',
 'PC_DIRSALES12',
 'PCH_PC_DIRSALES_07_12',
 'FMRKT09',
 'FMRKT16',
 'PCH_FMRKT_09_16',
 'FMRKTPTH09',
 'FMRKTPTH16',
 'PCH_FMRKTPTH_09_16',
 'FMRKT_SNAP16',
 'PCT_FMRKT_SNAP16',
 'FMRKT_WIC16',
 'PCT_FMRKT_WIC16',
 'FMRKT_WICCASH16',
 'PCT_FMRKT_WICCASH16',
 'FMRKT_SFMNP16',
 'PCT_FMRKT_SFMNP16',
 'FMRKT_CREDIT16',
 'PCT_FMRKT_CREDIT16',
 'FMRKT_FRVEG16',
 'PCT_FMRKT_FRVEG16',
 'FMRKT_ANMLPROD16',
 'PCT_FMRKT_ANMLPROD16',
 'FMRKT_BAKED16',
 'PCT_FMRKT_BAKED16',
 'FMRKT_OTHERFOOD16',
 'PCT_FMRKT_OTHERFOOD16',
 'VEG_FARMS07',
 'VEG_FARMS12',
 'PCH_VEG_FARMS_07_12',
 'VEG_ACRES07',
 'VEG_ACRES12',
 'PCH_VEG_ACRES_07_12',
 'VEG_ACRESPTH07',
 'VEG_ACRESPTH12',
 'PCH_VEG_ACRESPTH_07_12',
 'FRESHVEG_FARMS07',
 'FRESHVEG_FARMS12',
 'PCH_FRESHVEG_FARMS_07_12',
 'FRESHVEG_ACRES07',
 'FRESHVEG_ACRES12',
 'PCH_FRESHVEG_ACRES_07_12',
 'FRESHVEG_ACRESPTH07',
 'FRESHVEG_ACRESPTH12',
 'PCH_FRESHVEG_ACRESPTH_07_12',
 'ORCHARD_FARMS07',
 'ORCHARD_FARMS12',
 'PCH_ORCHARD_FARMS_07_12',
 'ORCHARD_ACRES07',
 'ORCHARD_ACRES12',
 'PCH_ORCHARD_ACRES_07_12',
 'ORCHARD_ACRESPTH07',
 'ORCHARD_ACRESPTH12',
 'PCH_ORCHARD_ACRESPTH_07_12',
 'BERRY_FARMS07',
 'BERRY_FARMS12',
 'PCH_BERRY_FARMS_07_12',
 'BERRY_ACRES07',
 'BERRY_ACRES12',
 'PCH_BERRY_ACRES_07_12',
 'BERRY_ACRESPTH07',
 'BERRY_ACRESPTH12',
 'PCH_BERRY_ACRESPTH_07_12',
 'SLHOUSE07',
 'SLHOUSE12',
 'PCH_SLHOUSE_07_12',
 'GHVEG_FARMS07',
 'GHVEG_FARMS12',
 'PCH_GHVEG_FARMS_07_12',
 'GHVEG_SQFT07',
 'GHVEG_SQFT12',
 'PCH_GHVEG_SQFT_07_12',
 'GHVEG_SQFTPTH07',
 'GHVEG_SQFTPTH12',
 'PCH_GHVEG_SQFTPTH_07_12',
 'FOODHUB16',
 'CSA07',
 'CSA12',
 'PCH_CSA_07_12',
 'AGRITRSM_OPS07',
 'AGRITRSM_OPS12',
 'PCH_AGRITRSM_OPS_07_12',
 'AGRITRSM_RCT07',
 'AGRITRSM_RCT12',
 'PCH_AGRITRSM_RCT_07_12',
 'FARM_TO_SCHOOL09',
 'FARM_TO_SCHOOL13',
 'PCT_DIABETES_ADULTS08',
 'PCT_DIABETES_ADULTS13',
 'PCT_OBESE_ADULTS08',
 'PCT_OBESE_ADULTS13',
 'PCT_HSPA15',
 'RECFAC09',
 'RECFAC14',
 'PCH_RECFAC_09_14',
 'RECFACPTH09',
 'RECFACPTH14',
 'PCH_RECFACPTH_09_14',
 'PCT_NHWHITE10',
 'PCT_NHBLACK10',
 'PCT_HISP10',
 'PCT_NHASIAN10',
 'PCT_NHNA10',
 'PCT_NHPI10',
 'PCT_65OLDER10',
 'PCT_18YOUNGER10',
 'MEDHHINC15',
 'POVRATE15',
 'PERPOV10',
 'CHILDPOVRATE15',
 'PERCHLDPOV10',
 'METRO13',
 'POPLOSS10']
In [77]:
m = list(df.columns)
for i in range(len(m)):
    m[i] = str(m[i])
df = df[m]
In [78]:
print("""
As seen in the DataFrame above, the location that corresponds to a hunger appears below the hunger index in a separate row.
Thus, we created a location column and set the value of the column equal to the location that each hunged index value.
We then dropped all the rows that contain NaN (which were the rows with the location data that is now in the new column) and re-indexed the DataFrame.
""")
As seen in the DataFrame above, the location that corresponds to a hunger appears below the hunger index in a separate row.
Thus, we created a location column and set the value of the column equal to the location that each hunged index value.
We then dropped all the rows that contain NaN (which were the rows with the location data that is now in the new column) and re-indexed the DataFrame.

In [79]:
df
Out[79]:
FIPS State County 2010 Census Population Population Estimate, 2011 Population Estimate, 2012 Population Estimate, 2013 Population Estimate, 2014 Population Estimate, 2015 Population Estimate, 2016 ... PCT_NHPI10 PCT_65OLDER10 PCT_18YOUNGER10 MEDHHINC15 POVRATE15 PERPOV10 CHILDPOVRATE15 PERCHLDPOV10 METRO13 POPLOSS10
0 01001 Alabama Autauga 54571 55255 55027 54792 54977 55035 55416 ... 0.040314 11.995382 26.777959 56580.0 12.7 0 18.8 0 1 0.0
1 01003 Alabama Baldwin 182265 186653 190403 195147 199745 203690 208563 ... 0.043343 16.771185 22.987408 52387.0 12.9 0 19.6 0 1 0.0
2 01005 Alabama Barbour 27457 27326 27132 26938 26763 26270 25965 ... 0.087409 14.236807 21.906982 31433.0 32.0 1 45.2 1 0 0.0
3 01007 Alabama Bibb 22915 22736 22645 22501 22511 22561 22643 ... 0.030548 12.681650 22.696923 40767.0 22.2 0 29.3 1 1 0.0
4 01009 Alabama Blount 57322 57707 57772 57746 57621 57676 57704 ... 0.031402 14.722096 24.608353 50487.0 14.7 0 22.2 0 1 0.0
5 01011 Alabama Bullock 10914 10722 10654 10576 10712 10455 10362 ... 0.036650 13.459776 22.264981 28251.0 39.6 1 51.2 1 0 0.0
6 01013 Alabama Butler 20947 20848 20665 20330 20283 20126 19998 ... 0.033418 16.656323 24.137108 33868.0 25.8 1 36.0 1 0 1.0
7 01015 Alabama Calhoun 118572 117736 117208 116475 115837 115285 114611 ... 0.079277 14.328847 22.877239 42091.0 20.0 0 30.7 0 1 0.0
8 01017 Alabama Chambers 34215 34006 34084 34123 33996 34043 33843 ... 0.020459 16.676896 22.513517 35560.0 22.4 0 34.4 1 0 1.0
9 01019 Alabama Cherokee 25989 26073 26017 26074 25944 25726 25725 ... 0.003848 17.896033 21.416753 39144.0 19.4 0 30.2 0 0 0.0
10 01021 Alabama Chilton 43643 43758 43693 43769 43874 43809 43941 ... 0.025205 13.566895 25.112847 42767.0 20.2 0 28.1 0 1 0.0
11 01023 Alabama Choctaw 13859 13610 13549 13384 13310 13201 12993 ... 0.000000 18.175915 22.663973 35089.0 24.4 1 33.5 1 0 1.0
12 01025 Alabama Clarke 25833 25549 25148 25105 24862 24726 24392 ... 0.015484 16.157628 24.731932 37317.0 22.2 1 30.9 1 0 0.0
13 01027 Alabama Clay 13932 13676 13461 13464 13503 13495 13492 ... 0.000000 17.578237 22.566753 38908.0 18.4 0 27.3 0 0 0.0
14 01029 Alabama Cleburne 14972 14976 14928 15031 15076 14996 14924 ... 0.006679 15.769436 23.717606 42136.0 18.9 0 27.7 0 0 0.0
15 01031 Alabama Coffee 49948 50484 51180 50729 50757 51063 51226 ... 0.102106 14.435012 24.193161 46858.0 16.2 0 23.7 0 0 0.0
16 01033 Alabama Colbert 54428 54460 54493 54456 54427 54295 54216 ... 0.025722 17.386272 22.109943 41171.0 18.1 0 26.9 0 1 0.0
17 01035 Alabama Conecuh 13228 13193 13007 12866 12621 12597 12395 ... 0.000000 17.856063 22.996674 29981.0 28.3 1 41.0 1 0 0.0
18 01037 Alabama Coosa 11539 11369 11201 11058 10794 10687 10581 ... 0.000000 17.072537 20.539042 36078.0 20.3 0 32.2 0 0 0.0
19 01039 Alabama Covington 37765 38066 37842 37890 37795 37661 37458 ... 0.002648 18.374156 22.568516 36355.0 22.3 0 34.1 1 0 0.0
20 01041 Alabama Crenshaw 13906 13903 13920 13874 13898 13876 13913 ... 0.007191 15.892421 23.788293 36759.0 19.9 0 29.6 1 0 0.0
21 01043 Alabama Cullman 80406 80457 80351 80731 81167 81858 82471 ... 0.022386 15.931647 23.183593 39290.0 19.4 0 24.7 0 0 0.0
22 01045 Alabama Dale 50251 50119 50296 49753 49389 49370 49226 ... 0.083580 13.450479 24.829357 45294.0 18.5 0 29.0 0 0 0.0
23 01047 Alabama Dallas 43820 43207 42748 41950 41532 40893 40008 ... 0.013692 14.068918 26.460520 29682.0 34.6 1 50.1 1 0 1.0
24 01049 Alabama DeKalb 71109 71389 70961 70882 70947 70996 70900 ... 0.049220 13.887131 25.827954 37305.0 20.6 0 28.9 0 0 0.0
25 01051 Alabama Elmore 79303 80030 80291 80661 80794 81238 81799 ... 0.063049 11.898667 23.589272 53548.0 14.0 0 19.9 0 1 0.0
26 01053 Alabama Escambia 38319 38227 38063 37877 37878 37827 37728 ... 0.031316 15.167410 22.649338 36840.0 24.4 1 32.0 1 0 0.0
27 01055 Alabama Etowah 104430 104236 104215 103790 103371 102873 102564 ... 0.028727 15.807718 22.968496 42145.0 19.0 0 30.7 0 1 0.0
28 01057 Alabama Fayette 17241 17063 16966 16858 16821 16723 16546 ... 0.000000 17.887594 22.255090 37085.0 20.4 0 29.4 0 0 0.0
29 01059 Alabama Franklin 31704 31734 31652 31505 31540 31542 31628 ... 0.006308 15.218900 24.813904 38535.0 21.1 0 32.4 0 0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3110 55129 Wisconsin Washburn 15911 15792 15845 15675 15701 15556 15648 ... 0.012570 21.243165 20.312991 45043.0 13.5 0 22.7 0 0 0.0
3111 55131 Wisconsin Washington 131887 132292 132727 132841 133433 133815 134296 ... 0.016681 13.498677 24.549046 70778.0 5.3 0 6.4 0 1 0.0
3112 55133 Wisconsin Waukesha 389891 390811 392709 394059 395383 396311 398424 ... 0.030008 14.282966 24.060571 78689.0 4.7 0 5.1 0 1 0.0
3113 55135 Wisconsin Waupaca 52410 52322 52040 52262 52108 51925 51533 ... 0.009540 18.053807 22.648350 54849.0 10.7 0 14.4 0 0 0.0
3114 55137 Wisconsin Waushara 24496 24579 24479 24324 24186 24041 24162 ... 0.040823 19.933867 19.733834 49912.0 11.8 0 20.2 0 0 0.0
3115 55139 Wisconsin Winnebago 166994 167646 168764 169518 169701 169565 169886 ... 0.031139 13.375331 21.636706 52725.0 11.3 0 13.3 0 1 0.0
3116 55141 Wisconsin Wood 74749 74588 74306 73892 73514 73288 73107 ... 0.010702 17.073138 22.748130 51025.0 11.3 0 16.1 0 0 0.0
3117 56001 Wyoming Albany 36299 36895 37364 37636 37846 38079 38256 ... 0.046833 8.722003 16.631312 44455.0 20.1 0 15.9 0 0 0.0
3118 56003 Wyoming Big Horn 11668 11742 11781 11979 11898 11991 12005 ... 0.017141 18.066507 25.822763 50056.0 12.1 0 13.9 0 0 0.0
3119 56005 Wyoming Campbell 46133 46594 47872 48116 48241 49333 48803 ... 0.039018 5.670561 28.140377 83042.0 7.5 0 8.9 0 0 0.0
3120 56007 Wyoming Carbon 15885 15824 15681 15799 15829 15554 15618 ... 0.081838 12.867485 23.613472 60209.0 11.4 0 13.7 0 0 0.0
3121 56009 Wyoming Converse 13833 13730 14035 14358 14210 14321 14191 ... 0.007229 12.838864 25.388564 70307.0 8.5 0 11.3 0 0 0.0
3122 56011 Wyoming Crook 7083 7139 7152 7154 7237 7414 7464 ... 0.000000 16.236058 23.845828 64851.0 7.7 0 10.7 0 0 0.0
3123 56013 Wyoming Fremont 40123 40595 41130 41010 40680 40355 40242 ... 0.017446 14.468011 25.451736 52408.0 12.9 0 18.2 0 0 0.0
3124 56015 Wyoming Goshen 13249 13592 13656 13547 13546 13592 13390 ... 0.075477 18.869349 20.386444 48146.0 15.1 0 19.3 0 0 0.0
3125 56017 Wyoming Hot Springs 4812 4819 4843 4840 4797 4745 4679 ... 0.062344 22.610141 20.033250 46021.0 11.9 0 16.3 0 0 0.0
3126 56019 Wyoming Johnson 8569 8632 8608 8619 8562 8587 8486 ... 0.000000 18.531917 22.126269 56845.0 8.2 0 10.6 0 0 0.0
3127 56021 Wyoming Laramie 91738 92637 94785 95929 96264 97183 98136 ... 0.129717 12.541150 24.418453 59147.0 10.6 0 13.6 0 1 0.0
3128 56023 Wyoming Lincoln 18106 18018 17940 18327 18580 18757 19110 ... 0.022092 12.377113 28.189550 62364.0 8.8 0 10.6 0 0 0.0
3129 56025 Wyoming Natrona 75450 76410 78602 81092 81432 82191 81039 ... 0.046388 12.447979 23.883366 56703.0 11.0 0 14.2 0 1 0.0
3130 56027 Wyoming Niobrara 2484 2487 2474 2546 2491 2497 2480 ... 0.000000 20.652174 18.921095 46693.0 13.3 0 19.0 0 0 0.0
3131 56029 Wyoming Park 28205 28476 28839 29096 29069 29056 29353 ... 0.088637 17.521716 20.957277 55527.0 9.6 0 13.8 0 0 0.0
3132 56031 Wyoming Platte 8667 8703 8736 8703 8775 8805 8680 ... 0.057690 20.733818 20.364601 51863.0 11.7 0 17.4 0 0 0.0
3133 56033 Wyoming Sheridan 29116 29285 29580 29777 29994 30069 30200 ... 0.048084 15.620278 22.272977 57122.0 9.5 0 13.2 0 0 0.0
3134 56035 Wyoming Sublette 10247 10145 10414 10082 10019 9877 9769 ... 0.009759 10.139553 23.694740 77581.0 6.1 0 7.1 0 0 0.0
3135 56037 Wyoming Sweetwater 43806 44028 45086 45144 44970 44693 44165 ... 0.093594 8.316212 27.094462 71867.0 8.5 0 10.2 0 0 0.0
3136 56039 Wyoming Teton 21294 21474 21688 22319 22846 23073 23191 ... 0.061050 9.852541 19.141542 83290.0 6.6 0 7.6 0 0 0.0
3137 56041 Wyoming Uinta 21118 20918 20997 21006 20871 20819 20773 ... 0.161000 8.873946 30.168577 62968.0 9.8 0 11.9 0 0 0.0
3138 56043 Wyoming Washakie 8533 8470 8437 8442 8306 8334 8235 ... 0.011719 17.672565 25.454119 56088.0 11.2 0 15.7 0 0 0.0
3139 56045 Wyoming Weston 7208 7112 7065 7163 7179 7230 7236 ... 0.027747 15.940622 21.822974 60986.0 9.8 0 13.1 0 0 0.0

3140 rows × 287 columns

In [80]:
#Creating the standardized dataframe since results from the excel file vary by county population

norm_df = df.copy()
norm_factors = {}

for st in norm_df.columns:
    if st == 'FIPS' or st == 'State' or st == 'County':
        continue
    temp = list(norm_df[st])
    total = len(temp)
    mn = 0.0
    for i in range(0, len(temp)):
        if np.isnan(temp[i]):
            total -= 1
        else:
            mn += temp[i]
    mn /= total
    st_dev = 0.0
    for i in range(len(temp)):
        if not np.isnan(temp[i]):
            st_dev += ((mn - temp[i]) ** 2)
    st_dev /= total
    st_dev = sqrt(st_dev)
    if(st_dev < 0.000001):
        st_dev = 1.0
    norm_factors[st] = [mn, st_dev]
    for i in range(len(temp)):
        if not np.isnan(temp[i]):
            temp[i] = (temp[i] - mn) / st_dev
    norm_df[st] = temp

#Standardized all inputs by setting mean to 0 and st.dev to 1 for each column

norm_df
Out[80]:
FIPS State County 2010 Census Population Population Estimate, 2011 Population Estimate, 2012 Population Estimate, 2013 Population Estimate, 2014 Population Estimate, 2015 Population Estimate, 2016 ... PCT_NHPI10 PCT_65OLDER10 PCT_18YOUNGER10 MEDHHINC15 POVRATE15 PERPOV10 CHILDPOVRATE15 PERCHLDPOV10 METRO13 POPLOSS10
0 01001 Alabama Autauga -0.139772 -0.138965 -0.140649 -0.142285 -0.142775 -0.143688 -0.143732 ... -0.042506 -0.930546 1.006029 0.645245 -0.552835 -0.354756 -0.474088 -0.538570 1.301141 -0.450116
1 01003 Alabama Baldwin 0.268211 0.276086 0.282797 0.292770 0.302020 0.309292 0.319839 ... -0.039304 0.211342 -0.126035 0.305732 -0.521786 -0.354756 -0.388643 -0.538570 1.301141 -0.450116
2 01005 Alabama Barbour -0.226401 -0.227186 -0.227902 -0.228623 -0.229462 -0.231340 -0.232879 ... 0.007284 -0.394624 -0.448709 -1.390946 2.443458 2.818842 2.345617 1.856769 -0.768556 -0.450116
3 01007 Alabama Bibb -0.240913 -0.241685 -0.241937 -0.242376 -0.242526 -0.242642 -0.242934 ... -0.052832 -0.766460 -0.212789 -0.635157 0.922024 -0.354756 0.647385 1.856769 1.301141 -0.450116
4 01009 Alabama Blount -0.130982 -0.131220 -0.132063 -0.133128 -0.134651 -0.135640 -0.136806 ... -0.051929 -0.278592 0.358067 0.151886 -0.242339 -0.354756 -0.110945 -0.538570 1.301141 -0.450116
5 01011 Alabama Bullock -0.279256 -0.279634 -0.279444 -0.279340 -0.278778 -0.279531 -0.280109 ... -0.046380 -0.580411 -0.341791 -1.648597 3.623345 2.818842 2.986459 1.856769 -0.768556 -0.450116
6 01013 Alabama Butler -0.247200 -0.247648 -0.248130 -0.249106 -0.249371 -0.250062 -0.250941 ... -0.049797 0.183879 0.217328 -1.193780 1.480918 2.818842 1.362992 1.856769 -0.768556 2.221650
7 01015 Alabama Calhoun 0.064712 0.058396 0.053849 0.048912 0.044215 0.039905 0.035450 ... -0.001314 -0.372618 -0.158937 -0.527951 0.580477 -0.354756 0.796915 -0.538570 1.301141 -0.450116
8 01017 Alabama Chambers -0.204809 -0.206086 -0.206157 -0.206352 -0.207238 -0.207654 -0.209032 ... -0.063498 0.188798 -0.267564 -1.056776 0.953074 -0.354756 1.192101 1.856769 -0.768556 2.221650
9 01019 Alabama Cherokee -0.231091 -0.231144 -0.231390 -0.231301 -0.231978 -0.232998 -0.233605 ... -0.081059 0.480292 -0.595117 -0.766574 0.487328 -0.354756 0.743512 -0.538570 -0.768556 -0.450116
10 01021 Alabama Chilton -0.174687 -0.175282 -0.176101 -0.176452 -0.176889 -0.177895 -0.178466 ... -0.058481 -0.554799 0.508737 -0.473214 0.611527 -0.354756 0.519217 -0.538570 1.301141 -0.450116
11 01023 Alabama Choctaw -0.269847 -0.270511 -0.270389 -0.270636 -0.270795 -0.271164 -0.272145 ... -0.085127 0.547211 -0.222630 -1.094914 1.263570 2.818842 1.095975 1.856769 -0.768556 2.221650
12 01025 Alabama Clarke -0.231590 -0.232799 -0.234108 -0.234305 -0.235302 -0.236045 -0.237640 ... -0.068757 0.064641 0.394975 -0.914509 0.922024 2.818842 0.818277 1.856769 -0.768556 -0.450116
13 01027 Alabama Clay -0.269613 -0.270303 -0.270664 -0.270388 -0.270202 -0.270268 -0.270634 ... -0.085127 0.404307 -0.251665 -0.785683 0.332080 -0.354756 0.433771 -0.538570 -0.768556 -0.450116
14 01029 Alabama Cleburne -0.266291 -0.266196 -0.266075 -0.265531 -0.265370 -0.265694 -0.266300 ... -0.078066 -0.028175 0.092042 -0.524307 0.409704 -0.354756 0.476494 -0.538570 -0.768556 -0.450116
15 01031 Alabama Coffee -0.154542 -0.154036 -0.152682 -0.154879 -0.155741 -0.155791 -0.156415 ... 0.022822 -0.347233 0.234069 -0.141960 -0.009466 -0.354756 0.049266 -0.538570 -0.768556 -0.450116
16 01033 Alabama Colbert -0.140228 -0.141477 -0.142319 -0.143326 -0.144465 -0.145943 -0.147364 ... -0.057933 0.358408 -0.388093 -0.602445 0.285506 -0.354756 0.391048 -0.538570 1.301141 -0.450116
17 01035 Alabama Conecuh -0.271863 -0.271828 -0.272084 -0.272241 -0.272912 -0.273004 -0.273955 ... -0.085127 0.470735 -0.123267 -1.508516 1.869039 2.818842 1.897028 1.856769 -0.768556 -0.450116
18 01037 Alabama Coosa -0.277259 -0.277590 -0.277733 -0.277846 -0.278526 -0.278824 -0.279446 ... -0.085127 0.283395 -0.857250 -1.014833 0.627052 -0.354756 0.957126 -0.538570 -0.768556 -0.450116
19 01039 Alabama Covington -0.193467 -0.193261 -0.194402 -0.194675 -0.195566 -0.196629 -0.198090 ... -0.082328 0.594610 -0.251139 -0.992404 0.937549 -0.354756 1.160059 1.856769 -0.768556 -0.450116
20 01041 Alabama Crenshaw -0.269696 -0.269586 -0.269228 -0.269117 -0.268989 -0.269107 -0.269360 ... -0.077525 0.001231 0.113153 -0.959691 0.564953 -0.354756 0.679427 1.856769 -0.768556 -0.450116
21 01043 Alabama Cullman -0.057229 -0.059359 -0.061437 -0.061882 -0.062307 -0.061953 -0.061837 ... -0.061460 0.010610 -0.067443 -0.754752 0.487328 -0.354756 0.156073 -0.538570 -0.768556 -0.450116
22 01045 Alabama Dale -0.153574 -0.155189 -0.155447 -0.157904 -0.159944 -0.160950 -0.162469 ... 0.003236 -0.582634 0.424071 -0.268599 0.347605 -0.354756 0.615343 -0.538570 -0.768556 -0.450116
23 01047 Alabama Dallas -0.174121 -0.177022 -0.179057 -0.182091 -0.184084 -0.186781 -0.190371 ... -0.070651 -0.434766 0.911225 -1.532727 2.847103 2.818842 2.868971 1.856769 -0.768556 2.221650
24 01049 Alabama DeKalb -0.086933 -0.088002 -0.090808 -0.092411 -0.093708 -0.095051 -0.096862 ... -0.033091 -0.478231 0.722307 -0.915481 0.673626 -0.354756 0.604663 -0.538570 -0.768556 -0.450116
25 01051 Alabama Elmore -0.060753 -0.060708 -0.061625 -0.062099 -0.063453 -0.063842 -0.063871 ... -0.018470 -0.953670 0.053714 0.399740 -0.351013 -0.354756 -0.356601 -0.538570 1.301141 -0.450116
26 01053 Alabama Escambia -0.191697 -0.192752 -0.193711 -0.194716 -0.195311 -0.196124 -0.197273 ... -0.052019 -0.172118 -0.227001 -0.953133 1.263570 2.818842 0.935764 1.856769 -0.768556 -0.450116
27 01055 Alabama Etowah 0.019528 0.015753 0.013208 0.009593 0.005914 0.002084 -0.001016 ... -0.054756 -0.019022 -0.131683 -0.523579 0.425229 -0.354756 0.796915 -0.538570 1.301141 -0.450116
28 01057 Alabama Fayette -0.259041 -0.259604 -0.259701 -0.259868 -0.260008 -0.260431 -0.261390 ... -0.085127 0.478274 -0.344745 -0.933294 0.642577 -0.354756 0.658066 -0.538570 -0.768556 -0.450116
29 01059 Alabama Franklin -0.212832 -0.213262 -0.213764 -0.214467 -0.214784 -0.215275 -0.215737 ... -0.078458 -0.159807 0.419456 -0.815886 0.751251 -0.354756 0.978487 -0.538570 -0.768556 -0.450116
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3110 55129 Wisconsin Washburn -0.263290 -0.263619 -0.263207 -0.263535 -0.263449 -0.263987 -0.264108 ... -0.071838 1.280586 -0.924761 -0.288923 -0.428637 -0.354756 -0.057541 -0.538570 -0.768556 -0.450116
3111 55131 Wisconsin Washington 0.107253 0.104374 0.102391 0.099642 0.098278 0.096370 0.095036 ... -0.067492 -0.571110 0.340355 1.794879 -1.701673 -0.354756 -1.798496 -0.538570 1.301141 -0.450116
3112 55133 Wisconsin Waukesha 0.931577 0.920968 0.915595 0.909331 0.903111 0.896243 0.894542 ... -0.053402 -0.383587 0.194470 2.435445 -1.794822 -0.354756 -1.937345 -0.538570 1.301141 -0.450116
3113 55135 Wisconsin Waupaca -0.146676 -0.148230 -0.149992 -0.150127 -0.151590 -0.153164 -0.155485 ... -0.075041 0.518015 -0.227296 0.505084 -0.863332 -0.354756 -0.944039 -0.538570 -0.768556 -0.450116
3114 55137 Wisconsin Waushara -0.235861 -0.235863 -0.236201 -0.236725 -0.237379 -0.238132 -0.238336 ... -0.041968 0.967535 -1.097728 0.105327 -0.692559 -0.354756 -0.324559 -0.538570 -0.768556 -0.450116
3115 55139 Wisconsin Winnebago 0.219420 0.216048 0.215112 0.213328 0.209710 0.205306 0.202765 ... -0.052207 -0.600602 -0.529428 0.333100 -0.770183 -0.354756 -1.061527 -0.538570 1.301141 -0.450116
3116 55141 Wisconsin Wood -0.075303 -0.077898 -0.080345 -0.083081 -0.085821 -0.088067 -0.090182 ... -0.073812 0.283539 -0.197496 0.195449 -0.770183 -0.354756 -0.762467 -0.538570 -0.768556 -0.450116
3117 56001 Wyoming Albany -0.198151 -0.196960 -0.195897 -0.195463 -0.195409 -0.195356 -0.195674 ... -0.035614 -1.713206 -2.024310 -0.336534 0.596002 -0.354756 -0.783829 -0.538570 -0.768556 -0.450116
3118 56003 Wyoming Big Horn -0.276847 -0.276412 -0.275919 -0.274991 -0.275134 -0.274851 -0.275135 ... -0.067006 0.521052 0.720756 0.116987 -0.645984 -0.354756 -0.997443 -0.538570 -0.768556 -0.450116
3119 56005 Wyoming Campbell -0.166731 -0.166323 -0.163029 -0.162978 -0.163471 -0.161063 -0.163749 ... -0.043877 -2.442801 1.412921 2.787914 -1.360127 -0.354756 -1.531478 -0.538570 -0.768556 -0.450116
3120 56007 Wyoming Carbon -0.263373 -0.263518 -0.263720 -0.263150 -0.263056 -0.263994 -0.264199 ... 0.001394 -0.722027 0.060942 0.939091 -0.754658 -0.354756 -1.018804 -0.538570 -0.768556 -0.450116
3121 56009 Wyoming Converse -0.269930 -0.270132 -0.268869 -0.267617 -0.268030 -0.267751 -0.268518 ... -0.077485 -0.728870 0.591081 1.756742 -1.204879 -0.354756 -1.275141 -0.538570 -0.768556 -0.450116
3122 56011 Wyoming Crook -0.291496 -0.290951 -0.290398 -0.289947 -0.289455 -0.288798 -0.288881 ... -0.085127 0.083394 0.130336 1.314961 -1.329077 -0.354756 -1.339225 -0.538570 -0.768556 -0.450116
3123 56013 Wyoming Fremont -0.185933 -0.185273 -0.184118 -0.185004 -0.186702 -0.188420 -0.189663 ... -0.066683 -0.339344 0.609947 0.307432 -0.521786 -0.354756 -0.538173 -0.538570 -0.768556 -0.450116
3124 56015 Wyoming Goshen -0.271796 -0.270568 -0.270054 -0.270131 -0.270070 -0.269972 -0.270943 ... -0.005331 0.713010 -0.902824 -0.037668 -0.180239 -0.354756 -0.420685 -0.538570 -0.768556 -0.450116
3125 56017 Wyoming Hot Springs -0.298752 -0.298280 -0.297621 -0.297119 -0.296951 -0.296931 -0.297311 ... -0.019216 1.607428 -1.008306 -0.209733 -0.677034 -0.354756 -0.741106 -0.538570 -0.768556 -0.450116
3126 56019 Wyoming Johnson -0.286748 -0.286235 -0.285844 -0.285406 -0.285384 -0.285223 -0.285787 ... -0.085127 0.632331 -0.383217 0.666703 -1.251453 -0.354756 -1.349906 -0.538570 -0.768556 -0.450116
3127 56021 Wyoming Laramie -0.021023 -0.020886 -0.016289 -0.014774 -0.015922 -0.015255 -0.014420 ... 0.052013 -0.800053 0.301353 0.853099 -0.878857 -0.354756 -1.029485 -0.538570 1.301141 -0.450116
3128 56023 Wyoming Lincoln -0.256277 -0.256587 -0.256654 -0.255314 -0.254604 -0.254233 -0.253629 ... -0.061771 -0.839274 1.427607 1.113585 -1.158304 -0.354756 -1.349906 -0.538570 -0.768556 -0.450116
3129 56025 Wyoming Natrona -0.073063 -0.072142 -0.066908 -0.060763 -0.061493 -0.060938 -0.066172 ... -0.036085 -0.822330 0.141547 0.655205 -0.816758 -0.354756 -0.965401 -0.538570 1.301141 -0.450116
3130 56027 Wyoming Niobrara -0.306190 -0.305646 -0.305031 -0.304230 -0.304036 -0.303781 -0.303967 ... -0.085127 1.139281 -1.340456 -0.155320 -0.459686 -0.354756 -0.452727 -0.538570 -0.768556 -0.450116
3131 56029 Wyoming Park -0.224011 -0.223553 -0.222563 -0.221934 -0.222376 -0.222850 -0.222623 ... 0.008581 0.390793 -0.732342 0.559982 -1.034105 -0.354756 -1.008124 -0.538570 -0.768556 -0.450116
3132 56031 Wyoming Platte -0.286435 -0.286011 -0.285444 -0.285145 -0.284729 -0.284559 -0.285200 ... -0.024136 1.158802 -0.909347 0.263303 -0.708084 -0.354756 -0.623618 -0.538570 -0.768556 -0.450116
3133 56033 Wyoming Sheridan -0.221100 -0.220998 -0.220245 -0.219823 -0.219534 -0.219764 -0.220060 ... -0.034292 -0.063838 -0.339403 0.689132 -1.049630 -0.354756 -1.072208 -0.538570 -0.768556 -0.450116
3134 56035 Wyoming Sublette -0.281387 -0.281456 -0.280195 -0.280871 -0.280907 -0.281292 -0.281904 ... -0.074810 -1.374272 0.085213 2.345728 -1.577475 -0.354756 -1.723731 -0.538570 -0.768556 -0.450116
3135 56037 Wyoming Sweetwater -0.174166 -0.174429 -0.171743 -0.172190 -0.173521 -0.175202 -0.177788 ... 0.013823 -1.810230 1.100554 1.883057 -1.204879 -0.354756 -1.392629 -0.538570 -0.768556 -0.450116
3136 56039 Wyoming Teton -0.246092 -0.245671 -0.244931 -0.242940 -0.241496 -0.241082 -0.241276 ... -0.020584 -1.442896 -1.274619 2.807995 -1.499850 -0.354756 -1.670327 -0.538570 -0.768556 -0.450116
3137 56041 Wyoming Uinta -0.246654 -0.247427 -0.247092 -0.247010 -0.247565 -0.247950 -0.248595 ... 0.085086 -1.676876 2.018652 1.162491 -1.003056 -0.354756 -1.211057 -0.538570 -0.768556 -0.450116
3138 56043 Wyoming Washakie -0.286863 -0.286747 -0.286379 -0.285954 -0.286170 -0.285994 -0.286547 ... -0.072738 0.426861 0.610659 0.605407 -0.785708 -0.354756 -0.805190 -0.538570 -0.768556 -0.450116
3139 56045 Wyoming Weston -0.291097 -0.291037 -0.290670 -0.289919 -0.289633 -0.289358 -0.289571 ... -0.055793 0.012756 -0.473798 1.002006 -1.003056 -0.354756 -1.082889 -0.538570 -0.768556 -0.450116

3140 rows × 287 columns

We also created a data dictionary that stored addresses as keys and the corresponding latitudes and longitudes in an array of size 2 as the values. We did this because we noticed that there were redundancies in the locations and realized that we could avoid pinging the API every time we needed to find coordinates (for efficiency). Thus, each time we were filling in the coordinates we first checked if the address already existed in the data dictionary. If the address did exist, we used the coordinates we already had. If it did not exist, we pinged the API and created a new entry in the data dictionary.

We also found that parking lots needed to be queried in a certain format. For example if you needed the address to lot A you needed to query with Lot A. As a result, when addresses contained the word "lot" we reformatted them. We also found that certain lots did not have exact coordinates associated with them or were stored in Google Maps under a slightly different name. We found the coordinates for these lots ourselves and hard coded them for accuracy.

In [81]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='MEDHHINC15', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 20000, 30000, 40000, 50000, 70000, 100000, 150000]
# vis.legend(title='Median Household Income 2015')
# vis.to_json('vega.json')
# vis.display()

Image(filename='MEDHHINC15.png')
Out[81]:
In [82]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='POVRATE15', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 2, 5, 10, 15, 20, 30, 50]
# vis.legend(title='Poverty Rate 2015')
# vis.to_json('vega.json')
# vis.display()

Image(filename='POVRATE15.png')
Out[82]:
In [83]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='PCT_LACCESS_POP15', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 5, 10, 20, 30, 50, 75, 100]
# vis.legend(title='Percentage with Low Access 2015')
# vis.to_json('vega.json')
# vis.display()

Image(filename='PCT_LACCESS_POP15.png')
Out[83]:
In [84]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='GROCPTH14', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 0.1, 0.25, 0.5, 1, 2, 3, 4]
# vis.legend(title='Grocery Stores per 1000 pop. 2015')
# vis.to_json('vega.json')
# vis.display()

Image(filename='GROCPTH14.png')
Out[84]:
In [85]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='PCT_SNAP16', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 5, 7.5, 10, 12.5, 15, 20, 25]
# vis.legend(title='Percentage SNAP participation 2016')
# vis.to_json('vega.json')
# vis.display()

Image(filename='PCT_SNAP16.png')
Out[85]:
In [86]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='PCT_WIC15', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 1, 1.25, 1.5, 1.75, 2, 2.5, 3]
# vis.legend(title='Percentage WIC participation 2016')
# vis.to_json('vega.json')
# vis.display()

Image(filename='PCT_WIC15.png')
Out[86]:
In [87]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='FMRKTPTH16', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 0.05, 0.1, 0.25, 0.5, 0.75, 1, 1.5]
# vis.legend(title='Farmers Markets per 1000 pop. 2016')
# vis.to_json('vega.json')
# vis.display()

Image(filename='FMRKTPTH16.png')
Out[87]:
In [88]:
# geo_data = [{'name': 'counties',
#              'url': county_topo,
#              'feature': 'us_counties.geo'},
#             {'name': 'states',
#              'url': state_topo,
#              'feature': 'us_states.geo'}
#              ]

# vis = vincent.Map(data=df, geo_data=geo_data, scale=1000, projection='albersUsa',
#                   data_bind='FOODINSEC_13_15', data_key='FIPS', map_key={'counties': 'properties.FIPS'})
# del vis.marks[1].properties.update
# vis.marks[0].properties.update.fill.value = '#084081'
# vis.marks[1].properties.enter.stroke.value = '#fff'
# vis.marks[0].properties.enter.stroke.value = '#7bccc4'
# vis.scales['color'].type = 'threshold'
# vis.scales['color'].domain = [0, 7.5, 10, 12.5, 15, 17.5, 20, 25]
# vis.legend(title='Percentage Food Insecurity 2013-2015')
# vis.to_json('vega.json')
# vis.display()

Image(filename='FOODINSEC_13_15.png')
Out[88]:
In [89]:
var_list = ['MEDHHINC15', 'POVRATE15', 'PCT_LACCESS_POP15', 'GROCPTH14', 'PCT_SNAP16', 'PCT_WIC15', 'FMRKTPTH16', 'FOODINSEC_13_15']

col_list = list(df.columns)

for name in col_list:
    if name not in var_list:
        del df[name]

for name in col_list:
    if name not in var_list:
        del norm_df[name]

for name in var_list:
    df = df[np.isfinite(df[name])]

for name in var_list:
    norm_df = norm_df[np.isfinite(norm_df[name])]

df = df[var_list]
norm_df = norm_df[var_list]

corr_mat = norm_df.corr()
sns.heatmap(corr_mat, cmap = 'RdYlGn', annot = True)
Out[89]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5fa9981860>
In [90]:
def transpose(l):
    new_l = []
    for i in range(len(l)):
        new_l += [[l[i]]]
    return new_l
In [91]:
sns.regplot(x='MEDHHINC15', y='PCT_LACCESS_POP15', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['PCT_LACCESS_POP15'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: 9.773776869996741e-05
Intercept: 18.317308501908414
In [92]:
sns.regplot(x='MEDHHINC15', y='GROCPTH14', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['GROCPTH14'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: -9.477952240306165e-07
Intercept: 0.29776148845657896
In [93]:
sns.regplot(x='MEDHHINC15', y='PCT_SNAP16', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['PCT_SNAP16'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: -9.018242637365478e-05
Intercept: 17.724617799086182
In [94]:
sns.regplot(x='MEDHHINC15', y='PCT_WIC15', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['PCT_WIC15'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: -8.599761099423255e-06
Intercept: 2.780156022794001
In [95]:
sns.regplot(x='MEDHHINC15', y='FMRKTPTH16', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['FMRKTPTH16'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: -8.947282320016604e-08
Intercept: 0.06265072657348184
In [96]:
sns.regplot(x='MEDHHINC15', y='FOODINSEC_13_15', data=df, fit_reg=True, marker='+')
lr = linear_model.LinearRegression().fit(transpose(list(df['MEDHHINC15'])), df['FOODINSEC_13_15'])
print("Coefficient: " + str(lr.coef_[0]))
print("Intercept: " + str(lr.intercept_))
Coefficient: -4.9165358872128996e-05
Intercept: 16.666134103348114